import React from 'react';

import {

} from 'react-native';

import BaseAction from './BaseAction';
import Constants from '../../common/Constants';
import Functions from '../../common/Functions';

export default class CommonCheckUserTypeAction extends BaseAction {
    constructor() {
      super();
      this.moduleType = Constants.MODULE_TYPE.COMMON;
      this.name = "CommonCheckUserTypeAction";

      this._callback = null;
    }
    //needLogin
    //needVerify
    call(caller, data, callback) {
      this._callback = callback;
      this._baseCall(caller, data);
    }

    finish(result, type) {
      if(!result) {
        if(type == 1) {//需要登录
          Functions.loginInfoUserAlert(this.caller, "游客身份不能进行此操作");
        }
        else if(type == 2){//需要认证
          Functions.verifyAlert(this.caller, "非实名认证用户不能进行此操作");
        }
        return;
      }
      this._callback(result);
    }
}
